//IBRPG Loader v .5
// copyright Andrew Wooldridge 2007

var theHead = document.getElementsByTagName('head')[0];
var theResources = [
	{url:"http://yui.yahooapis.com/2.2.0/build/yahoo-dom-event/yahoo-dom-event.js",type:"js"},
	{url:"http://yui.yahooapis.com/2.2.0/build/animation/animation-min.js",type:"js"},
	{url:"http://yui.yahooapis.com/2.2.0/build/container/container-min.js",type:"js"},
	{url:"http://yui.yahooapis.com/2.2.0/build/dragdrop/dragdrop-min.js",type:"js"},
	{url:"http://yui.yahooapis.com/2.2.0/build/element/element-beta-min.js",type:"js"},
	{url:"http://yui.yahooapis.com/2.2.0/build/container/assets/container.css",type:"css"},
	{url:"json.js",type:"js"},
	{url:"ibrpgmain.js",type:"js"}
	];
	
if(ibrpgconfig && ibrpgconfig.world){
	try{
		theResources[theResources.length] = {url:ibrpgconfig.world, type:"js"}
	}catch(err){
		//hide the error
	}
}	
var bootStrap = function(){
	var resLen = theResources.length;
	for(i = 0; i< resLen; i++){
		var item = theResources[i];
		if(item.type === "js"){
			var newScript = document.createElement('script');
			newScript.setAttribute('src',item.url);
			theHead.appendChild(newScript);
		}else{
			if(item.type === "css"){
				var newStyle = document.createElement('link');
				newStyle.setAttribute('href',item.url);
				newStyle.setAttribute('rel','stylesheet');
				newStyle.setAttribute('type','text/css');
				theHead.appendChild(newStyle);
			}
		}
	}


}

bootStrap();	
